package com.zyk.scaffold.seata.biz.feign.stock.request;

import com.zyk.scaffold.seata.biz.business.buy.pojo.request.BuyRequest;
import lombok.Data;

@Data
public class StockRequest {
    private String commodityCode;
    private Integer count;

    public static StockRequest of(String commodityCode, Integer count){
        StockRequest stockRequest = new StockRequest();
        stockRequest.setCommodityCode(commodityCode);
        stockRequest.setCount(count);
        return stockRequest;
    }

    public static StockRequest of(BuyRequest buyRequest) {
        return of(buyRequest.getCommodityCode(), buyRequest.getCount());
    }
}
